package cn.evun.tms.generator.handler.impl;

import cn.evun.tms.generator.Constants;
import cn.evun.tms.generator.config.Configuration;
import cn.evun.tms.generator.handler.BaseHandler;
import cn.evun.tms.generator.model.ControllerInfo;

import java.io.File;

public class ControllerHandler extends BaseHandler<ControllerInfo> {

	public ControllerHandler(String ftlName, ControllerInfo info) {
		this.ftlName = ftlName;
		this.info = info;
		this.savePath = Configuration.getString("base.baseDir") + File.separator
				+ Configuration.getString("controller.path") + File.separator + info.getClassName()
				+ Constants.FILE_SUFFIX_JAVA;
	}

	@Override
	public void combileParams(ControllerInfo controllerInfo) {
		this.param.put("me", info);
		this.param.put("url", info.getEntityInfo().getEntityName().toLowerCase());
		this.param.put("lowerEntityName", info.getLowerEntityName());
	}

}
